import { registerTheme, registerMap } from 'echarts/lib/echarts'

import './dependency'
import './theme'

import VChart from './Core'
import BarChart from './BarChart'
import LineChart from './LineChart'
import PieChart from './PieChart'
import AreaChart from './AreaChart'
import MapChart from './MapChart'
import RadarChart from './RadarChart'
import ProgessChart from './ProgessChart'
import WordCloudChart from './WordCloudChart'
import LiquidFillChart from './LiquidFillChart'
import FunnelChart from './FunnelChart'
import GaugeChart from './GaugeChart'

const components = [
  VChart,
  BarChart,
  LineChart,
  PieChart,
  AreaChart,
  MapChart,
  ProgessChart,
  RadarChart,
  WordCloudChart,
  LiquidFillChart,
  FunnelChart,
  GaugeChart,
]

const install = function(Vue) {
  components.forEach(component => {
    Vue.component(component.name, component)
  })
}

if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue)
}

export {
  registerTheme,
  registerMap,
  VChart,
  BarChart,
  LineChart,
  AreaChart,
  PieChart,
  MapChart,
  ProgessChart,
  RadarChart,
  WordCloudChart,
  LiquidFillChart,
  FunnelChart,
  GaugeChart,
}

export default {
  install,
}
